import 'package:floor/floor.dart';

@entity
class GroupMemberEntity {
  @primaryKey
  int? id;
  int? createAt;
  int? userId;
  int? groupId;
  String? nickname;
  int? mute;

  GroupMemberEntity(
      {this.id,
        this.createAt,
        this.userId,
        this.groupId,
        this.nickname,
        this.mute});

  GroupMemberEntity.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    createAt = json['createAt'];
    userId = json['userId'];
    groupId = json['groupId'];
    nickname = json['nickname'];
    mute = json['mute'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['createAt'] = this.createAt;
    data['userId'] = this.userId;
    data['groupId'] = this.groupId;
    data['nickname'] = this.nickname;
    data['mute'] = this.mute;
    return data;
  }

  static List<GroupMemberEntity> fromJsonList(List<dynamic> jsonList) {
    return jsonList.map((json) => GroupMemberEntity.fromJson(json)).toList();
  }
}